﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Interfleet.SE.UICompiler.Core
{
    /// <summary>
    /// This interface provides access to the file system.
    /// </summary>
    public interface IFileProvider
    {
        /// <summary>
        /// Reads the content of a file and returns it as a <see cref="System.String"/>
        /// </summary>
        /// <param name="filePath">Full path of the file</param>
        /// <returns></returns>
        string ReadFileToEnd(string filePath);

        /// <summary>
        /// Saves the content to the specified file. If the file does not exist it will be created.
        /// If the file exists it will be overwritten.
        /// </summary>
        /// <param name="filePath">Full path of the file</param>
        /// <param name="fileContent">The content to  be written to the file</param>
        void SaveToFile(string filePath, string fileContent);

        /// <summary>
        /// Returns the requested files size in bytes
        /// </summary>
        /// <param name="filePath">Full path of the file</param>
        /// <returns>Size in bytes</returns>
        long GetFileSize(string filePath);

        /// <summary>
        /// Returns the last time the file was written to.
        /// </summary>
        /// <param name="filePath">Full path of the file</param>
        /// <returns>A <see cref="DateTime"/> representing last write time</returns>
        DateTime GetLastWriteTime(string filePath);

        /// <summary>
        /// Returns true if the file exists, otherwise false
        /// </summary>
        /// <param name="filePath">Full path of the file</param>
        /// <returns></returns>
        bool FileExists(string filePath);
    }
}
